#ifndef USER_H
#define USER_H

#include <QObject>
#include <QByteArray>
#include <QHostAddress>
#include <QDateTime>
#include <QUdpSocket>
#include <QDebug>

class User : public QObject
{
	Q_OBJECT
	
private:
	QByteArray *nick;
	QHostAddress *address;
	QByteArray *realName;
	bool isBlocked;
	uint lastSeen;	//timestamp for the last user alive msg
	QUdpSocket *sock;		//the user socket
	QByteArray *uID;		//the random user ID (the ip address is not a good candidate as unique field)
	
	void createUserID();
public:
	User(QByteArray *nickC, QHostAddress *addressC, QByteArray *realNameC, bool createUid, QByteArray *id = 0);
	User(QByteArray nickC, QString addressC, QByteArray realNameC, bool createUid, QByteArray id = 0);
	virtual ~User();
	QHostAddress* getAddress();
	void updateLastSeen();
	QByteArray* getNick();
	QByteArray* getRealName();
	QByteArray* getID();
	uint getLastSeen();
	void setNick(QString newNick);
	void setRealName(QString newRealName);
};
#endif
